import 'package:flutter_oldman_health/models/response_data_model.dart';

class MessageModel {
  int code;
  List<MessageItem> data;
  String msg;

  MessageModel.fromJson(Map<String, dynamic> json) {
    code = json["code"];
    var messageItem = json["data"] as List;
    data = messageItem.map((e) => MessageItem.fromJson(e)).toList();
    msg = json["msg"];
  }
}

class MessageItem {
  String id;
  String senderId;
  String receiverId;
  String content;
  String inDate;

  MessageItem.fromJson(Map<String, dynamic> json) {
    id = json["id"];
    senderId = json["senderId"];
    receiverId = json["receiverId"];
    content = json["content"];
    inDate = json["inDate"];
  }
}

class MessageAddModel extends ResponseDataModel<List<MessageAddItem>> {
  MessageAddModel({int code, List<MessageAddItem> data, String msg})
      : super(code: code, data: data, msg: msg);

  factory MessageAddModel.fromJson(Map<String, dynamic> json) {
    var data = json["data"] as List;
    print(data);
    return MessageAddModel(
        code: json["code"],
        data: data.map((e) => MessageAddItem.fromJson(e)).toList(),
        msg: json["msg"]);
  }
}

class MessageAddItem {
  String id;
  String senderId;
  String msgType;
  String content;
  int read;

  MessageAddItem.fromJson(Map<String, dynamic> json) {
    id = json["id"];
    senderId = json["senderId"];
    msgType = json["msgType"];
    content = json["content"];
    read = json["read"];
  }
}